{% extends 'blogmanage/layoutA.html' %}

{% import 'blogobj/helper.html' as helper %}

{% block styles %}

{% endblock %}


{% block blog_header %}
    <section class="all_page_slider_bg">
        <div class="container">
            <div class="row">
                <div class="col-xs-12 ">
                    <div class="normal_service_text all_page_slider_text">
                        <h2>博客</h2>
                        <ol class="breadcrumb">
                            <li><a href="{{ url_for('blog.blog_index') }}">首页</a><span></span></li>
                            <li class="active"><a href="#">管理中心</a></li>
                        </ol>
                    </div>
                </div><!-- column End -->
            </div><!-- row End -->
        </div><!-- container End -->
    </section>
{% endblock %}


{% block main_content %}
    <section>
    <div class="row">

        <div class="col-lg-8">
            <div class="panel">
                <div class="panel-heading">
                    <h3>博客列表</h3>
                </div>
                <div class="panel-body">
                <table class="table table-striped custom-table table-hover">
                    <thead>
                    <tr>
                        <th><i class="fa fa-bookmark-o"></i> 标题</th>
                        <th class="hidden-xs"><i class="fa fa-building-o"></i> 作者</th>
                        <th><i class="fa fa-bar-chart-o"></i> 阅读次数</th>
                        <th><i class=" fa fa-edit"></i> 状态</th>
                        <th><i class=" fa fa-external-link"></i> 提交时间</th>

                        <th class="hidden-xs"><i class="fa fa-cogs"></i> 操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for art in arts.items %}

                    <tr>
                        <td><a href="#">{{ art.title }}</a></td>
                        <td class="hidden-xs">{{ art.author }}</td>
                        <td>{{ art.numbrowse }}</td>
                        <td><span class="label label-mini {{ 'label-info' if art.isshow else 'label-primary'}}">{{ '显示' if art.isshow else '不显示' }}</span></td>
                        <td><span class="text-xs">{{ art.releasetime.strftime('%Y-%m-%d %H:%M:%S') }}</span></td>
                        <td class="">
                            <a href="{{ url_for('blog.blog_detail', id=art.id) }}" id="detail" class="btn btn-success btn-xs"><i class="fa fa-check"></i></a>
                            <a href="{{ url_for('.blog_edit', id=art.id) }}" id="edit" class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></a>
                            <a href="{{ url_for('.blog_del', id=art.id) }}" id="del" class="btn btn-danger btn-xs"><i class="fa fa-trash-o "></i></a>
                        </td>
                    </tr>

                    {% endfor %}
                    </tbody>
                </table>
                </div>
            {{ helper.render_admin_page(arts, '.blog_list') }}
            </div>
        </div>
    </div>
</section>

{% endblock %}

{% block scripts %}
{#    <script>#}
{#        $(document).ready(function () {#}
{#            $("#del").click(function () {#}
{#                var id = $("#blogid").val();#}
{#                $.ajax({#}
{#                    url:'/manage/del/',#}
{#                    method:'GET',#}
{#                    data:{blogid:id},#}
{#                    datatype:'json',#}
{#                    success:function (response) {#}
{#                        if(response == true){#}
{#                            alert('删除成功')#}
{#                        }#}
{#                        else {#}
{#                            alert('未知异常导致删除失败，请联系管理员')#}
{#                        }#}
{#                        window.location.reload()#}
{#                    }#}
{#                });#}
{#            });#}
{#        });#}
{#    </script>#}
{% endblock %}